#pragma once
#include<iostream>
#include<assert.h>
using namespace std;
class Date
{

	friend ostream& operator<<(ostream& out, const Date& d);
	friend istream& operator>>(istream& in, Date& d);
public:

	int GetMonthDay(int year,int month)
	{
		assert(month > 0 && month <13);
		static int GetMonthDayArry[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
		if ((month == 2) && (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
		{
			return 29;
		}
		return GetMonthDayArry[month];
	}

	Date(int year = 2000, int month = 1, int day = 1);

	void print();

	bool DateCheck();

	Date(const Date& d)
	{
		_year = d._year;
		_month = d._month;
		_day = d._day;
	}

	bool operator<(const Date& d);
	bool operator>(const Date& d);
	bool operator<=(const Date& d);
	bool operator>=(const Date& d);
	bool operator==(const Date& d);
	bool operator!=(const Date& d);

	Date& operator+=(int day);
	Date operator+(int day);

	Date& operator-=(int day);
	Date operator-(int day);

	//++d1
	Date& operator++();
	//d1++
	Date operator++(int);

	//--d1
	Date& operator--();
	//d1--
	Date operator--(int);

	int operator-(const Date& d);

private:
	int _year;
	int _month;
	int _day;
 };

